package cn.juan.day2homework;

public class day2homework {
    private String name;
    private String job;
    private int salary;

    @Override
    public String toString() {
        return "Worker{" +
                "name='" + name + '\'' +
                ", job='" + job + '\'' +
                ", salary=" + salary +
                '}';
    }

    public day2homework(String name, String job, int salary) {
        this.name = name;
        this.job = job;
        this.salary = salary;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getJob() {
        return job;
    }

    public void setJob(String job) {
        this.job = job;
    }

    public int getSalary() {
        return salary;
    }

    public void setSalary(int salary) {
        this.salary = salary;
    }
    public int dojob(int months) {
        int total=months*salary;
        System.out.println(name+"工作了"+months+"个月，获得"+total+"工资");
        return total;
    }

    public static void main(String[] args) {
        day2homework worker = new day2homework("张三","Java开发岗",3000);
        System.out.println(worker.dojob(3));
    }

}
